package com.example.demo3.service;

import com.example.demo3.meal.User;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;

@Service
public class UserServiceIml implements UserService {
    JdbcTemplate jdbcTemplate;
    public UserServiceIml(JdbcTemplate jdbcTemplate){
        this.jdbcTemplate=jdbcTemplate;
    }
   // @Override
     public int addUser(User user){
        String sql="insert into user (username,password,email,id) value(?,?,?,?)";
        return jdbcTemplate.update(sql,user.getUsername(),user.getPassword(),user.getEmail(),user.getId());
    }

    @Override
    public int updateUser(User user) {return 0;
    }

    @Override
    public int deleteUser(int id) {
        return 0;
    }

    @Override
    public int findUser(int id) {
        return id;
    }
}
